home *** CD-ROM | disk | FTP | other *** search
Wrap
property MEMBERSX, POSITIONS property meSprite, buttonSprite property activityList, activity, formerActivity, positionH, positionV, positionHButtons, monkeyRunning --actualSettings property playList --list of movements to do property Pname, Ploc --casual props property ULstopList, URstopList, upButtonHListL, upButtonHListR, DLstopList, DRstopList, downButtonHList, buttonHvalue, stopNum, initPlay, buttonV --buttonStopsInFlashMovies property transMember, transLoc, transFrame property myColor global sessionObject property percentFrame, turnMonkey -------------------------------------------------------------------------------------------------------------------------------- --recieve calls from buttons and timeOut, make a profile -------------------------------------------------------------------------------------------------------------------------------- on testCall me monkeyRunning = 1 playList = [[#movesHorizontal, #R], [#corners, #D], [#movesVertical, #D], [#corners, #R], [#movesHorizontal, #R], [#corners, #U], [#movesVertical, #U], [#corners, #S], [#rests, #S]] meSprite.activate() end on callFromUpButton me, whichButton, whichSprite if activity = #b then exit else -- meSprite.holdMonkey() monkeyRunning = 1 buttonV = #U buttonSprite = whichSprite if (activity = #R or activity = #A) = 0 then --om han inte är på väg horisontellt så ska han få en av de två sätten if random(2) = 1 then multiply = 2 --värde för att hitta rätt nuffra i swf för att stanna vid rätt knapp, armgång är ca dubbelt så många frames som springa buttonActivity = #A else multiply = 1 buttonActivity = #R end if else buttonActivity = activity if activity = #A then multiply = 2 else multiply = 1 end if end if if activity = #C then meSprite.frameEnd() playList = [[#rests, #S], [#movesHorizontal, buttonActivity], [#buttons, #B]] else if activity = #S then --om han vilar sig den late faan! playList = [[#movesHorizontal, buttonActivity], [#buttons, #B]] --denna lista ska utföras före dir-fil-bytet else if activity = #D then interruptMonkeyUpDown me if the result = 1 then playList = [[#movesHorizontal, buttonActivity], [#buttons, #B]] positionV = #U else playList = [[#movesVertical, #U], [#corners, #R], [#movesHorizontal, buttonActivity], [#buttons, #B]] end if else if activity = #U then playList = [[#corners, #R], [#movesHorizontal, buttonActivity], [#buttons, #B]] --------------------------------- else if activity = #R or activity = #A then if positionV = #U then --där uppe interruptMonkeyHorisontal me, whichButton, multiply if the result = 2 then playList = [[#movesHorizontal, buttonActivity], [#buttons, #B]] else if the result = 1 then meSprite.activate(stopNum) exit else playList = [[#movesHorizontal, buttonActivity], [#buttons, #B]] end if ---------------------------------- else --där nere playList = [[#corners, #U], [#movesVertical, #U], [#corners, #R], [#movesHorizontal, buttonActivity], [#buttons, #B]] end if end if initPlay = [[#movesHorizontal, buttonActivity], [#rests, #S]] --denna lista ska utföras efter dir-fil-bytet när apan har tryckt och ska springa hem igen if positionH = #L then stopNum = (ULstopList[whichButton]) * multiply buttonHvalue = upButtonHListL[whichButton] else stopNum = (URstopList[whichButton]) * multiply buttonHvalue = upButtonHListR[whichButton] end if if activity = #C then meSprite.frameEnd() end if if turnMonkey <> 0 then ---nytt reloadMe me ---nytt end if ---nytt meSprite.activate(stopNum) end if end on callFromDownButton me, whichButton, whichSprite if activity = #b then exit else -- meSprite.holdMonkey() monkeyRunning = 1 if whichButton < 3 then positionHButtons = #L else positionHButtons = #R end if buttonV = #D buttonSprite = whichSprite if activity = #C then meSprite.frameEnd() playList = [[#rests, #S], [#corners, #D], [#movesVertical, #D], [#corners, #R], [#movesHorizontal, #R], [#buttons, #B]] else if activity = #S then --om han vilar sig den late faan! playList = [[#corners, #D], [#movesVertical, #D], [#corners, #R], [#movesHorizontal, #R], [#buttons, #B]] --dessa listor ska utföras före dir-fil-bytet else if activity = #D then playList = [[#corners, #R], [#movesHorizontal, #R], [#buttons, #B]] else if activity = #U then interruptMonkeyUpDown me if the result = 1 then playList = [[#movesHorizontal, #R], [#buttons, #B]] positionV = #D else playList = [[#movesVertical, #D], [#corners, #R], [#movesHorizontal, #R], [#buttons, #B]] end if else if activity = #R or activity = #A then if positionV = #D then --där nere interruptMonkeyHorisontal me, whichButton if the result = 2 then playList = [[#movesHorizontal, #R], [#buttons, #B]] else if the result = 1 then meSprite.activate(stopNum) exit else playList = [[#movesHorizontal, #R], [#buttons, #B]] end if else --där uppe playList = [[#corners, #D], [#movesVertical, #D], [#corners, #R], [#movesHorizontal, #R], [#buttons, #B]] end if end if initPlay = [[#movesHorizontal, #R], [#corners, #U], [#movesVertical, #U], [#corners, #S], [#rests, #S]] --denna lista ska utföras efter dir-fil-bytet if positionH = #L then stopNum = DLstopList[whichButton] else stopNum = DRstopList[whichButton] end if buttonHvalue = downButtonHList[whichButton] if turnMonkey <> 0 then ---nytt reloadMe me ---nytt end if ---nytt meSprite.activate(stopNum) end if end on callFromStage me if activity = #b then exit else -- meSprite.holdMonkey() if activity <> #S then --om han inte vilar sig, om han är på väg, så måste man avbryta aktiviteten och mata in en ny playlist meSprite.ButNum = 0 --se till så han inte stannar vid en knapp if activity = #R or activity = #A then --om han är i färd med att springa eller armkroka sig fram horisontellt... if positionV = #U then --där uppe playList = [[#rests, #S]] else --där nere playList = [[#corners, #U], [#movesVertical, #U], [#corners, #S], [#rests, #S]] end if else if activity = #D then --om han är på väg ner playList = [[#movesVertical, #U], [#corners, #S], [#rests, #S]] else if activity = #U then --om han är på väg upp playList = [[#corners, #S], [#rests, #S]] end if end if end if end on restMe me playList = [[#rests, #S]] meSprite.activate(0) positionV = #U end on chocoMe me if activity = #S then if positionH = #R then playList = [[#movesHorizontal, #R], [#choco, #C], [#rests, #S]] else playList = [[#choco, #C], [#rests, #S]] end if else if positionV = #D then if positionH = #R then playList = [[#corners, #U], [#movesVertical, #U], [#corners, #R], [#movesHorizontal, #R], [#choco, #C], [#rests, #S]] else playList = [[#corners, #U], [#movesVertical, #U], [#corners, #S], [#rests, #S], [#choco, #C], [#rests, #S]] end if else if positionH = #R then playList = [[#movesHorizontal, #R], [#choco, #C], [#rests, #S]] end if end if end if meSprite.activate(0) end -------------------------------------------------------------------------------------------------------------------------------- -- Set the f monkey to work! -------------------------------------------------------------------------------------------------------------------------------- on traceMonkey me --när man ska byta dir-fil, komma ihåg var ap-j är nånstans if activity <> #S then transMember = meSprite.member --så att nästa film ska veta vilken member och loc den ska börja apan med transLoc = meSprite.loc transFrame = meSprite.frame end if end on interruptMonkeyUpDown me --när man trycker på en ny knapp medan ap-j redan är ute och ränner och han måste vända turnMonkey = 1 interruptFrame = meSprite.frame totalFrames = meSprite.member.frameCount if interruptFrame < 10 then return 1 --så liten bit in att det är bättre att skippa swfen och ta nästa direkt else totalPercent = totalFrames * 0.01 perFrame = interruptFrame / totalPercent percentFrame = perFrame * 0.01 end if end on interruptMonkeyHorisontal me, whichButton, multiply if multiply = void then multiply = 1 interruptFrame = meSprite.frame totalFrames = meSprite.member.frameCount framesLeft = totalFrames - interruptFrame if framesLeft < 10 then return 2 --så liten bit kvar att det är bättre att springa klart och sen vända else if interruptFrame < 4 then return 1 --så liten bit in att det är bättre att inte göra nånting else if positionH = #R then if positionV = #U then newStopNum = (ULstopList[whichButton]) * multiply newbuttonHvalue = upButtonHListL[whichButton] else newStopNum = (DLstopList[whichButton]) * multiply newbuttonHvalue = downButtonHList[whichButton] end if else if positionV = #U then newStopNum = (URstopList[whichButton]) * multiply newbuttonHvalue = upButtonHListR[whichButton] else newStopNum = (DRstopList[whichButton]) * multiply newbuttonHvalue = downButtonHList[whichButton] end if end if if interruptFrame <= newStopNum then StopNum = newStopNum buttonHvalue = newbuttonHvalue return 1 --knappen ligger ändå framför så gör ingenting är du bussig! else turnMonkey = 1 transFrame = framesLeft end if end if end on reCoverMe me --från init på ap-spriten, så att nya filmen ska veta vilken member och loc den ska börja apan med monkeyRunning = 0 if transMember = 0 then restMe me else meSprite.member = transMember meSprite.loc = transLoc updateStage transMember = 0 transLoc = 0 if activity <> #b then --om apan blir avbruten av annat klick när den redan är igång meSprite.setFrameStart(transFrame) transFrame = 0 else --om apan står och trycker på en knapp transFrame = stopNum stopNum = 0 switchPositionValue me, #H playList = initPlay end if meSprite.activate(0) end if end on reloadMe me makeOne me, playList[1][1], playList[1][2] playList.deleteAt(1) end -------------------------------------------------------------------------------------------------------------------------------- on makeOne me, PactivityList, Pactivity setValues me, PactivityList, Pactivity makeName me setmember me end on setValues me, PactivityList, Pactivity --bestämma värdena activityList = PactivityList formerActivity = activity activity = Pactivity end on setmember me --sätta member liksom if MEMBERSX[activityList][Pname] <> "" then meSprite.member = member(MEMBERSX[activityList][Pname]&myColor, 2) meSprite.loc = Ploc updatestage ---nytt if percentFrame <> 0 then --om apan ska vända åt andra hållet if transFrame = 0 then totFrame = meSprite.member.frameCount perFrame = totFrame * percentFrame transFrame = integer(totFrame - perFrame) percentFrame = 0 end if end if turnMonkey = 0 ---nytt slut if transFrame <> 0 then meSprite.setFrameStart(transFrame) transFrame = 0 end if if Pname = #DL or Pname = #DR then positionV = #D else if Pname = #UL or Pname = #UR then positionV = #U -- else if Pname = #RL or Pname = #AL then -- positionH = #R -- else if Pname = #RR or Pname = #AR then -- positionH = #L end if end if end on makeName me --tillverka ett lämpligt namn och hoppas att det finns en castmember som passar case activityList of #movesVertical: Pname = symbol(activity&positionH) Ploc = POSITIONS[activityList][positionH] -- switchPositionValue me, #V #movesHorizontal: Pname = symbol(activity&positionH) nom = symbol(activity&positionV) Ploc = POSITIONS[activityList][nom] switchPositionValue me, #H #corners: Pname = symbol(formerActivity&activity&positionH) nom = symbol(positionV&positionH) Ploc = POSITIONS[activityList][nom] #rests: Pname = symbol(activity&(random(2))&positionH) Ploc = POSITIONS[activityList][positionH] #choco: Pname = symbol(activity&"L") Ploc = POSITIONS[activityList][positionH] #restHard: Pname = symbol(activity&1&positionH) Ploc = POSITIONS[activityList][positionH] #buttons: if buttonV = #U then Pname = symbol(activity&(random(2))&positionH) Ploc = point(buttonHvalue, 75) else Pname = symbol(activity&(random(2))&positionHButtons) Ploc = point(buttonHvalue, 608) end if end case end -------------------------------------------------------------------------------------------------------------------------------- on switchPositionValue me, p --ändra från upp till ner och höger till vänster å sånt därnt if p = #H then if positionH = #L then positionH = #R else positionH = #L end if -- else -- if positionV = #U then -- positionV = #D -- else -- positionV = #U -- end if end if end -------------------------------------------------------------------------------------------------------------------------------- -- return calls on activateGoScript me --skicka tillbaks till knappen att det är klart för avfärd till nästa dir-movie traceMonkey me buttonSprite.GoScript() end -------------------------------------------------------------------------------------------------------------------------------- --initValues -------------------------------------------------------------------------------------------------------------------------------- on readValues me --händer bara när man startar cdn MEMBERSX = \ [ \ #movesVertical: \ [#UL: "hna1001", #DL: "hna1003", #UR: "hna1002", #DR: "hna1004"], \ #movesHorizontal: \ [#AL: "hna1027", #RL: "hna1029", #AR: "hna1028", #RR: "hna1030"], \ #corners: \ [#SRL: "", #RSL: "", #SAL: "hna1010", #ASL: "hna1009", #SDL: "hna1011", #USL: "hna1013", #ADL: "hna1012", #UAL: "hna1013", #RDL: "hna1012", #URL: "hna1013", #DRL: "hna1031", #RUL: "hna1031", #SRR: "", #RSR: "", #SAR: "hna1021", #ASR: "hna1020", #SDR: "hna1022", #USR: "hna1024", #ADR: "hna1023", #UAR: "hna1024", #RDR: "hna1023", #URR: "hna1024", #DRR: "hna1032", #RUR: "hna1032"], \ #rests: \ [#S1L: "hna1005", #S2L: "hna1006", #S3L: "hna1015", #S4L: "hna1014", #S1R: "hna1016", #S2R: "hna1017", #S3R: "hna1026", #S4R: "hna1025"], \ #choco: \ [#CL: "isia02"], \ #restHard: \ [#S1L: "hna1005", #S1R: "hna1016"], \ #buttons: \ [#B1R: "hna1007", #B2R: "hna1008", #B1L: "hna1018", #B2L: "hna1019"] \ ] POSITIONS = \ [ \ #movesVertical: \ [#L: point(53, 294), #R: point(740, 295)], \ #movesHorizontal: \ [#RU: point(400, 53), #RD: point(400, 578), #AU: point(400, 102)], \ #corners: \ [#UL: point(85, 85), #UR: point(703, 85), #DL: point(75, 540), #DR: point(733, 540)], \ #rests: \ [#L: point(30, 80), #R: point(750, 80)], \ #choco: \ [#L: point(73, 81)], \ #restHard: \ [#L: point(40, 80), #R: point(745, 80)] \ ] end -------------------------------------------------------------------------------------------------------------------------------- on new me --(föds en enda gång från sessionobject on new) percentFrame = 0 ---Nytt!!!! transFrame = 0 ---Nytt!!!! meSprite = sprite(150) myColor = string(sessionobject.myColor).char[1] readValues me positionH = #L positionV = #U activity = #S playList = [] ULstopList = [4, 8, 11, 14, 19, 22, 25, 29, 33, 36] --frameNums in runningFlash URstopList = [36, 33, 29, 25, 23, 19, 15, 12, 8, 4] upButtonHListL = [110, 165, 219, 269, 339, 382, 437, 495, 560, 620] --locValues for buttonFlash upButtonHListR = [176, 229, 286, 352, 402, 452, 516, 566, 626, 673] DLstopList = [2, 5, 30, 34, 40] --frameNums in runningFlash DRstopList = [40, 36, 12, 9, 4] downButtonHList = [115, 170, 520, 574, 667] --locHValues for buttonFlash return me end --------------------------------------------------------------------------------------------------------------------------------